package com.usian.model.behavior.pojos;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.Getter;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * APP行为实体表,一个行为实体可能是用户或者设备，或者其它
 * </p>
 *
 * @author itusian
 */
@Data
@TableName("ap_behavior_entry")
public class ApBehaviorEntry implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	@TableId(value = "id", type = IdType.AUTO)
	private Integer id;

	/**
	 * 实体类型
	 0终端设备
	 1用户
	 */
	@TableField("type")
	private Short type;

	/**
	 * 实体ID
	 */
	@TableField("entry_id")
	private Integer entryId;

	/**
	 * 创建时间
	 */
	@TableField("created_time")
	private Date createdTime;

	@Alias("ApBehaviorEntryEnumType")
	public enum  Type{
		USER((short)1),EQUIPMENT((short)0);
		@Getter
		short code;
		Type(short code){
			this.code = code;
		}
	}

	public boolean isUser(){
		if(this.getType()!=null&&this.getType()== Type.USER.getCode()){
			return true;
		}
		return false;
	}
}
